from access.core import ProgrammingLanguage
from access.core import UtterancePattern

class Python(ProgrammingLanguage):
  create_new = \
  [
   'add',
   'add new',
   'create',
   'create new',
   'insert',
   'insert new',
   'new',
  ]
  
  class_with = \
  [
   'class',
   'class with',
   'class having',
   'class containing',
   ]
  
  small_number = \
  [
   '0',
   '1',
   '2',
   '3',
   '4',
   '5',
   '6',
   '7',
   '8',
   '9',
   '10',
   'zero',
   'one',
   'two',
   'three',
   'four',
   'five',
   'six',
   'seven',
   'eight',
   'nine',
   'ten',
   ]
  
  common_context = \
  {
   'break': '\n',
   'tab': '  '
   }
  
  def CreateVocabulary(self):
    vocabulary = {}
    vocabulary['en-us'] = \
    {
     'create class': UtterancePattern \
     ('[create_new] [class_with] [small_number] fields', '''
class ${name}(${object}):
{{tab}}def __init__(self,{% for i in count %}
{{tab}}{{tab}}          ${field{{i}}},):
{% end for %}
''',
      count = range(11),
      
# trim, combine common context with other context.
      ),

#     'create empty class': \
#     UtterancePattern('[create] class',
#                          'create class with zero members',
#                          ),
#     
#     'create field': \
#     UtterancePattern('',
#                          '',
#                          ),
#
#     'create property': \
#     UtterancePattern('',
#                          '',
#                          ),
#
#     'create method': \
#     UtterancePattern('',
#                          '',
#                          ),
#     
#     'create procedure': \
#     UtterancePattern('',
#                          '',
#                          ),
#
#     'create function': \
#     UtterancePattern('',
#                          '',
#                          ),
#     
#     'create literal expression': \
#     UtterancePattern('',
#                          '',
#                          ),
#     
#     'assignment': \
#     UtterancePattern('',
#                          '',
#                          ),
#
#     'create string expression': \
#     UtterancePattern('',
#                          '',
#                          ),
     }
    return vocabulary
  
  def CreateSnippets(self):
    pass
